/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-06-17 09:04:43
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-09-28 10:01:13
 * @FilePath: \linePatrol\vue-element-plus-admin\src\views\linePatrol\LssuePlan\components\PublicTableData.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { FormSchema } from '@/components/Form'
import { reactive, computed } from 'vue'
import { useValidator } from '@/hooks/web/useValidator'
import { UserListAlltype } from '@/api/department/types'
import { usePatrolGroupStore } from '@/store/modules/PlanGroupStore'
const GroupStore = usePatrolGroupStore()
const UserList = computed(() => {
  return GroupStore.getUserListAll
}) //执行用户列表
const { required } = useValidator()
export const schema = reactive<FormSchema[]>([
  {
    field: 'planName',
    label: '计划名称',
    component: 'Input',
    colProps: {
      span: 15
    }
  },
  {
    field: 'executeUser',
    label: '执行用户',
    component: 'Select',
    colProps: {
      span: 15
    },
    componentProps: {
      options: UserList.value.map((item: UserListAlltype) => {
        return {
          label: item.userName,
          value: item.userName
        }
      })
    }
  },
  {
    field: 'startDate',
    label: '执行开始日期',
    component: 'DatePicker',
    componentProps: {
      type: 'datetime',
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    colProps: {
      span: 15
    }
  },
  {
    field: 'endDate',
    label: '执行结束日期',
    component: 'DatePicker',
    componentProps: {
      type: 'datetime',
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    colProps: {
      span: 15
    }
  }
])
export const rules = reactive({
  planName: [required()],
  taskId: [required()],
  executeUser: [required()],
  startDate: [required()],
  endDate: [required()]
})
